home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
SCIENTIF
/
1256A.ZIP
/
RADDECAY.TRU
< prev
next >
Wrap
Text File
|
1987-11-19
|
10KB
|
251 lines
! Raddecay 2.0
! *****************
! Copyright (c) 1987 Grove Engineering, Inc.
! All rights reserved
! 15215 Shady Grove Rd., Suite 202, Rockville, MD 20850
! (301) 258-2727
!
! *****************
! POST RELEASE REVISION HISTORY
!
! 2.00: Negin/Tocus - Initial release
!
! Program changes:
! 2.01 - 10/24/87
! Bound in text files READINFO.DOC AND FILEINFO.DOC
! Faster box routine
! Halflife print format modified to accomodate double digit exponentials
!
! 2.02 - 11/20/87
! Added full names and atomic weight info
! Textshow calls modified to ensure proper box alignment with coprocessor - True Basic fix
!
LIBRARY "\MS\RADDECAY\RADDKLIB.TRC"
LIBRARY "\MS\TRC\DKLIB.TRC"
LIBRARY "\MS\TRC\PCSTUFF.TRC"
LIBRARY "\TRU\3dLIB.TRC", "\TRU\ARC.TRC", "\TRU\PATLIB.TRC"
LIBRARY "\TRU\TEXTLIB.TRC","\TRU\STRLIB.TRC","\TRU\SCRLIB.TRC"
LIBRARY "\TRU\DOSLIB.TRC", "\TRU\FNTLIB.TRC"
LIBRARY "\TRU\POPUPLIB.TRC"
! DEFINITION OF VARIABLES CARRIED THRU COMMON
PUBLIC true ! 1
PUBLIC false ! 0
PUBLIC graphics_prog ! true if this prog does graphics (it doesnt)
PUBLIC va$ ! vertical arrows; this avoids printer gas when listing
PUBLIC ha$ ! horizontal arrows; be nice to the printer
PUBLIC colour$(4) ! string of the color number - NOT THE NAME
PUBLIC recpath$ ! path for record files, nuclide library and coefficients??
PUBLIC ver$ ! string of version
PUBLIC video$ ! video card type
PUBLIC Program_name$ ! "RADDECAY" for passing to sub FATAL
PUBLIC screensave$ ! holding string for saved screen - text mode
PUBLIC screen$ ! holding string for saved screen - text mode
PUBLIC first_time ! flag for creating new name screen
PUBLIC picrecl ! unused, defined in pcstuff
PUBLIC demovideo$ ! unused, defined in pcstuff
PUBLIC debug ! unused, defined in pcstuff
PUBLIC debug2 ! unused, defined in pcstuff
PUBLIC nuclide$(497) ! names of nuclides
PUBLIC at_names$(100) ! names of elements
PUBLIC mol_wt(100) ! atomic weights
DECLARE DEF rjust$,elapsed$,spaces$,center$ ! TrueBasic library stuff
!***************************** INITIALIZATION *******************************
LET true = 1
LET false = 0
LET graphics_prog=false ! for general config routines
LET Program_name$ = "RADDECAY" ! for use in error messages
LET ha$ = chr$(27)&", "&chr$(26) ! horizontal arrows
LET va$ = chr$(24)&", "&chr$(25) ! vertical arrows
LET first_time = true
!*************************** CUSTOMIZED STUFF *****************************
LET ver$ = "2.02" ! version - ONLY HARD CODE HERE!
SET CURSOR "off"
LET video$ = "MONO"
LET ver$ = trim$(ver$)
LET sessiondate = date
LET sessiontime = time
DIM dummy(1),menu$(5),pathpurpose$(1)
CLEAR
WHEN ERROR IN ! For handling initiation errors
CALL Get_setup(defaults) ! Load setup parameters
USE
CALL fatal(0,"","return") ! initiation error
STOP
END WHEN
! if RADDECAY.DAT doesn't exist then select configuration menu item
IF defaults = true then LET preferred = 4 else LET preferred = 1
CALL normal
LET footer$ = " Use "&va$&" and [Enter] or press number to select. "
LET header1$ = " RADDECAY MAIN MENU "
LET menu$(1) = " Execute RADDECAY"
LET menu$(2) = " General information"
LET menu$(3) = " Information about files"
LET menu$(4) = " Computer configuration (also [Esc])"
LET menu$(5) = " Quit this session "
CALL initialize_raddecay
DO
CLEAR
CALL generic_menu(menu$,preferred,6,choice,dummy,false,0,header1$,footer$)
WHEN error in
SELECT CASE choice
CASE 1 ! read file data
DO
WHEN error in
CALL Pick_one_nuclide(nuclide)
CALL show_nuclide(nuclide)
USE
IF extype = 100 then ! expected, handle at this level
EXIT DO
ELSEIF extype=105 then ! expected, handle at higher level
EXIT HANDLER
ELSE
CALL fatal(0,"","") ! unexpected
END IF
END WHEN
LOOP
LET preferred = 1
CASE 2 ! special info
CALL read_doc1
LET preferred = 3
CASE 3 ! file info
CALL read_doc2
LET preferred = 1
CASE 4,999 ! Configure the computer
LET progname$ = "RADDECAY" ! used for .DAT file
LET path1$ = recpath$
LET path2$,path3$ = ""
! pathpurpose format is: "Path for "&pathpurpose$(i)&" files: "
LET pathpurpose$(1) = "library record"
CALL Change_setup(progname$,path1$,path2$,path3$,pathpurpose$())
LET video$ = "MONO" ! don't allow anything else
LET recpath$ = path1$
LET preferred = 1
LET first_time = true
CASE 5 ! Quit this session
EXIT DO
END SELECT
USE ! For handling execution errors
IF Extype = 100 then ! Escape key pressed to request main menu
LET preferred = 1 ! next menu preferred
ELSEIF extype = 105 then ! expected, handle at higher level
LET preferred = 4
ELSE
CALL fatal(extype,extext$,"return") ! unexpected error, don't do exit handler
LET preferred = 1 ! next menu preferred
END IF
END WHEN
LOOP ! never exits, do stop stmt
CLEAR
CALL plain_double_edge_box(8,20,59,14)
SET CURSOR 10,1
CALL highlight
CALL print_centered(" RADDECAY SESSION TERMINATED ")
CALL normal
PRINT
CALL print_centered("Session elapsed time: "&elapsed$(date,time,sessiondate,sessiontime))
SET CURSOR 24,1
SET CURSOR "on"
END
SUB Welcome
DECLARE PUBLIC ver$,colour$(),recpath$
CALL normal
CALL plain_double_edge_box(4,21,58,8)
SET CURSOR 6,1
CALL highlight
CALL print_centered(" RADDECAY "&ver$&" ")
SET CURSOR 15,1
CALL print_centered( " A program for the public domain ")
CALL print_centered( " by Grove Engineering, Inc. ")
CALL normal
SET CURSOR 24,1
CALL print_centered("For the IBM PC with DOS 2.1 or equivalent.")
CALL print_centered("October/1987 - Grove Engineering,Inc.")
END SUB
SUB Get_setup(defaults)
DIM msg$(5)
DECLARE PUBLIC colour$(),mspath$,matpath$,recpath$,video$
LET defaults = false
WHEN error in
OPEN #1: NAME "RADDECAY.DAT", access input, organization text, create old
INPUT #1: colour$(1)
INPUT #1: colour$(2)
INPUT #1: colour$(3)
INPUT #1: colour$(4)
INPUT #1: recpath$ ! .REC files drive:directory
CLOSE #1
USE ! create new config file:
CLEAR ! for debugging, will show up on scroll back
IF extype <> 9003 then ! if it wasn't "file doesn't exist" error
UNSAVE "RADDECAY.DAT" ! somehow corrupted
EXIT HANDLER ! can't deal with it
END IF
CALL set_defaults
END WHEN
CLEAR
CALL Welcome
PAUSE 2
! check to see if record files are in directory
WHEN error in
OPEN #1: name recpath$ & "NUCLIDES.REC",access input,recsize 41
CLOSE #1
LET rec_check = 1
USE
CLOSE #1
IF extype = 9003 then
LET rec_check = 2
ELSE
CALL fatal(0,"","return")
LET rec_check = 3
END IF
END WHEN
SELECT CASE rec_check
CASE 1
! all ok
CASE 2
LET msg$(1) = " Did not find file NUCLIDES.REC ! "
LET msg$(2) = "in path "&recpath$
LET msg$(3) = " "
LET msg$(4) = "Please configure your *.REC file path"
LET msg$(5) = "specification from the main menu. "
CALL bleep
CALL info_window(msg$,0)
CASE 3 ! problem with read
CALL set_defaults
END SELECT
SUB set_defaults
CALL default_colors(colour$) ! set 'em
CALL askdir(path$) ! get current drive 'n path
LET drive$ = path$[1:2] ! save drive designator
LET recpath$ = path$&"\" ! default
OPEN #1: name "RADDECAY.DAT",access output,create newold,organization text
ERASE #1
PRINT #1: colour$(1)
PRINT #1: colour$(2)
PRINT #1: colour$(3)
PRINT #1: colour$(4)
PRINT #1: recpath$
CLOSE #1
LET defaults = true ! tell caller that defaults were set
END SUB
END SUB
SUB demopic
! subroutine for generic library
! draw picture
SET CURSOR 12,1
PRINT "This feature not needed for RADDECAY"
PRINT "Please ignore any messages"
PRINT "Press [Enter] or [Esc]"
END SUB